/**
 *
 */
package com.et114.modules.org.services;

import java.util.List;

import com.et114.components.acegi.cache.CacheProvider;
import com.et114.core.exception.CheckException;

/*
 * @author guanhw
 */
public class DbCacheProvider implements CacheProvider {
	private UserManager		userManager;
	private FunctionManager	functionManager;

	/*
	 * (non-Javadoc)
	 *
	 * @see com.et114.components.acegi.cache.CacheProvider#getFunctions()
	 */
	public List getResourcesWithPrincipals ( ) throws CheckException {
		// TODO Auto-generated method stub
		List funcs =  /* new java.util.ArrayList();*/functionManager.getFuncsWithPrincipals() ;
		funcs.addAll ( functionManager.getFuncClsWithPrincipals ( ) ) ;
		return funcs ;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see com.et114.components.acegi.cache.CacheProvider#getRoles()
	 */
	public List getUsersWithPrincipals ( ) throws CheckException {
		// TODO Auto-generated method stub
		return userManager.getUsersRels ( );
	}


	public void setUserManager ( UserManager userManager ) {
		this.userManager = userManager;
	}

	public void setFunctionManager ( FunctionManager functionManager ) {
		this.functionManager = functionManager;
	}

}
